package com.pshcp.common.enums;

/**
 * @Description: 婚姻状况 0未婚 1已婚 2离异 3丧偶
 * @Author: xiaoche
 * @Date: 2022/10/29 12:36
 */
public enum MaritalStatusEnum {

    SINGLE(0, "未婚"),

    MARRIED(1, "已婚"),

    DIVORCE(2,"离异"),

    WIDOWED(3,"丧偶"),

    ;

    private Integer code;
    private String desc;

    MaritalStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static String getDescByCode(int code){
        for(MaritalStatusEnum e : MaritalStatusEnum.values()){
            if(e.getCode().intValue() == code){
                return e.getDesc();
            }
        }
        return null;
    }

}
